package com.sefon.smarteconomy.controller;

import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;

import org.jasig.cas.client.util.AssertionHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sefon.smarteconomy.domain.vo.ResponseObject;
import com.sefon.smarteconomy.service.IUserService;

/**
 * 
* Copyright: Copyright (c) 2018 SefonSoft
* 
* @ClassName: BaseController.java
* @Description: 基本controller
*
* @version: v1.0.0
* @author: SF2170
* @date: 2018年3月21日上午11:02:06
*
 */
@RestController
public class BaseController {

	@Autowired
	private IUserService userService;
	
	@RequestMapping(value = "/login")
	public ResponseObject login(HttpServletRequest request) {
		
		String name = request.getRemoteUser();
		String userName = AssertionHolder.getAssertion().getPrincipal().getName();
		System.out.println(name );
		System.out.println(userName );
		userService.queryList();
		return new ResponseObject(1, "", 
			new HashMap<String, Object>(){
				private static final long serialVersionUID = 1L;
				{
					put("loginName", name);
				}
			});
	}

	

}
